let systemData: any = {
  // 环境 ali支付宝 ding钉钉 wct微信 
  ue: (function () {
    const userAgent = navigator.userAgent.toLowerCase();
    // 浏览器型号
    if (/firefox/.test(userAgent)) return ('ffox');
    else if (/chrome/.test(userAgent)) return ('chm');
    else if (/msie/.test(userAgent)) return ('ie');
    else if (/safari/.test(userAgent)) return ('saf');
    else if (/alipayclient/.test(userAgent)) return ('ali');
    else if (/aliapp\(dingtalk/.test(userAgent)) return ('ding');
    return '';
  })(),
  // 判断端来源
  pfm: (function () {
    const userAgent = navigator.userAgent.toLowerCase();
    if (/miniprogram/.test(userAgent)) return ('wx-mini');
    else if (/micromessenger/.test(userAgent)) return ('wx-h5');
    else if ((window as any).webkit && (window as any).webkit.messageHandlers && (window as any).webkit.messageHandlers.jsToOcMain) return ('ios');
    else if ((window as any).hybridApp && (window as any).hybridApp.exec) return ('android');
    return 'h5';
  })(),
  // 系统
  os: navigator.appVersion.toLowerCase().replace(/^[^\(]*\(([^\)]*)\).*$/, '$1').replace(/;/g, ''),
  // 分辨率
  uhw: window.screen.height + '*' + window.screen.width
}

function getSystemData() {
  systemData.pageurl = window.location.href.replace(window.location.origin, '');
  return systemData;
}
export default getSystemData;